package com.java2401.yangnan.service.impl;

import com.java2401.yangnan.mapper.UserLoginMapper;
import com.java2401.yangnan.pojo.UserLogin;
import com.java2401.yangnan.service.UserLoginService;
import com.java2401.yangnan.util.MD5Util;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional
public class UserLoginServiceImpl implements UserLoginService {
    @Resource
    UserLoginMapper userLoginMapper;
    @Override
    public UserLogin login(String username, String password) {
        String encode = MD5Util.encode(password);
        return userLoginMapper.login(username,encode) ;
    }

    @Override
    public Integer register(String username, String password){
        return userLoginMapper.register(username,password);
    }

    @Override
    public UserLogin select(String username) {
        return userLoginMapper.select(username);
    }
}
